'use strict';

module.exports = app => {
  const { STRING, INTEGER, BOOLEAN, TEXT, DATE } = app.Sequelize;

  const Activites = app.model.define('activites', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    title: STRING,
    content: TEXT,
    user_id: INTEGER,
    images: STRING,
    plantforms: STRING,
    cooperations: STRING,
    del: BOOLEAN, // 发布人设置不可见
    top: BOOLEAN, // 置顶
    hot: BOOLEAN, // 热门可以不用 一个帖子 普通or hot or top 都是or 的关系. 不会出现又置顶又热门
    start: DATE,
    end: DATE,
    des: STRING,
    attach: STRING,
    watch: INTEGER,
  });

  Activites.associate = function() {
    app.model.Activites.belongsTo(app.model.User, { foreignKey: 'user_id', targetKey: 'id' });
  };

  return Activites;
};
